package com.itheima.demo;

import java.util.ArrayList;

public class Demo_addAll {
    public static void main(String[] args) {
        //泛型通配符:
        //<?>
        //< ? extends E> //类型本身或者其子类;
        //< ? super E > //本类型或者其父类;
        ArrayList<Person> list = new ArrayList<>();
        list.add(new Person());
        list.add(new Person());
        list.add(new Person());
        list.add(new Person());


        ArrayList<Student> list1 = new ArrayList<>();
        list.add(new Student());
        list.add(new Student());
        list.add(new Student());
        list.add(new Student());


        list.addAll(list1);
        //可以吧子类对象添加到父类的集合当中;

        //list1.addAll(list);
        // 不能把父类对象添加到子类集合当中;

        list.add(new Student());
        //父类引用指向子类对象;

        //list1.add(new Person());
        // 不能把父类对象添加到子类集合当中;
        System.out.println(list);

    }
}
